subroutine wtraj(ss,step,y)
use var
use type
use parallel
implicit none
integer :: step, ss, y, iout, ratio
real(dp), dimension(:,:), allocatable :: ee
character*20 :: string = "traj frame"
real, allocatable :: qsingle(:,:)

allocate (qsingle(6,tnodes))
qsingle = q
frame = 0
iout = 200 
OPEN ( iout , FILE ="new_Q",form='UNFORMATTED',access='SEQUENTIAL')
Print *,"ratio of smaple to traj is", int(traj/sample)
print *,"enter new ratio"
read(*,*)ratio
allocate(ee(5,ratio))
ee(:,1)=trj_E(:,1)
call RANDOM_SEED(get = iseed(1:2))
   write(iout)string
   write(iout)frame,ss,step,y
   write(iout)ISEED    
   write(iout)ee
   write(iout)NP_position
   write(iout)qsingle
end subroutine

